package com.emergencywhitelist;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

public class EWLListener implements Listener
{
	@EventHandler
	public void onPlayerLogin(PlayerJoinEvent event)
	{
		Player player = event.getPlayer();
		if (EmergencyWhitelist.isEnabled == true)
		{
			if (!player.hasPermission("EmergencyWhitelist.whitelist"))
			{
				player.kickPlayer("EmergencyWhitelist has been enabled.");
				EmergencyWhitelist.logger().info(player.getName() + " failed to connect.");
			}
		}
	}
}
